package com.anjiplus.template.gaea.business.modules.flowable.process.service;

import com.anji.plus.gaea.curd.service.GaeaBaseService;
import com.anjiplus.template.gaea.business.modules.flowable.process.controller.dto.TaskInfoDTO;
import com.anjiplus.template.gaea.business.modules.flowable.process.controller.param.ActReProcdefParam;
import com.anjiplus.template.gaea.business.modules.flowable.process.controller.param.RunningTaskParam;
import com.anjiplus.template.gaea.business.modules.flowable.process.dao.entity.ActReProcdef;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.flowable.ui.modeler.domain.Model;

import java.util.Map;

/**
 * (ActReProcdef)Service
 *
 * @author lirui
 * @since 2021-03-18 14:41:29
 */
public interface ProcessService extends GaeaBaseService<ActReProcdefParam, ActReProcdef> {

    /**
     * 启动流程
     *
     * @param processDefinitionId 流程定义ID
     * @param businessKey 流程关联的业务Key
     * @param map 前端填写的表单数据
     */
    void startProcess(String processDefinitionId, String businessKey, Map<String, Object> map);

    /**
     * 完成任务
     *
     * @param taskId 任务ID
     * @param requestBody 表单数据
     */
    void completeTask(String taskId, Map<String, Object> requestBody);

    /**
     * 获取表单数据
     *
     * @param processDefinitionId 流程定义ID
     * @return
     */
    Model getFormModel(String processDefinitionId);


    /**
     * 待办
     *
     * @param param
     * @return
     */
    IPage<TaskInfoDTO> getRunningTasks(RunningTaskParam param);


    /**
     * 已办
     *
     * @param param
     * @return
     */
    IPage<TaskInfoDTO> getHistoricTaskInstanceIPage(RunningTaskParam param);

    /**
     * 任务详情
     * @param taskId
     * @return
     */
    TaskInfoDTO taskDetail(String taskId);


    /**
     * 流程实例
     * @param processInstanceId
     * @return
     */
    TaskInfoDTO processInstanceDetail(String processInstanceId);

}
